load("//tools/build_defs/android:fb_xplat_android_cxx_library.bzl", "fb_xplat_android_cxx_library")
load("//tools/build_defs/oss:profilo_defs.bzl", "profilo_path")

fb_xplat_android_cxx_library(
    name = "jni",
    srcs = [
        "NativeTraceWriter.cpp",
    ],
    header_namespace = "profilo/jni",
    exported_headers = [
        "NativeTraceWriter.h",
    ],
    compiler_flags = [
        "-fexceptions",
        "-frtti",
        "-std=gnu++14",
        "-DLOG_TAG=\"Profilo/Writer\"",
    ],
    labels = [],
    preferred_linkage = "static",
    visibility = [
        profilo_path("..."),
    ],
    deps = [
        ":writer_callbacks",
    ],
    exported_deps = [
        profilo_path("cpp/mmapbuf:buffer_jni"),
        profilo_path("cpp/writer:trace_backwards"),
        profilo_path("cpp/writer:trace_headers"),
        profilo_path("cpp/writer:writer"),
        profilo_path("deps/fbjni:fbjni"),
    ],
)

fb_xplat_android_cxx_library(
    name = "jmulti_buffer_logger",
    srcs = [
        "JMultiBufferLogger.cpp",
    ],
    header_namespace = "profilo/jni",
    exported_headers = [
        "JMultiBufferLogger.h",
    ],
    compiler_flags = [
        "-fexceptions",
        "-frtti",
        "-std=gnu++14",
        "-DLOG_TAG=\"Profilo/Logger\"",
    ],
    labels = [],
    soname = "libprofilo_jmulti_buffer_logger.$(ext)",
    visibility = [
        profilo_path("..."),
    ],
    deps = [
        profilo_path("deps/linker:locks"),
    ],
    exported_deps = [
        profilo_path("cpp:jni_logger_helpers"),
        profilo_path("cpp/util:util"),
        profilo_path("cpp/mmapbuf:buffer_jni"),
        profilo_path("cpp/logger:logger"),
        profilo_path("cpp/logger:multi_buffer_logger"),
        profilo_path("deps/fbjni:fbjni"),
    ],
)

fb_xplat_android_cxx_library(
    name = "writer_callbacks",
    srcs = [
        "NativeTraceWriterCallbacks.cpp",
    ],
    header_namespace = "profilo/jni",
    exported_headers = [
        "NativeTraceWriterCallbacks.h",
    ],
    compiler_flags = [
        "-fexceptions",
        "-frtti",
        "-std=gnu++14",
        "-DLOG_TAG=\"Profilo/Writer\"",
    ],
    labels = [],
    preferred_linkage = "static",
    visibility = [
        profilo_path("..."),
    ],
    exported_deps = [
        profilo_path("cpp/writer:writer"),
        profilo_path("deps/fbjni:fbjni"),
    ],
)
